/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package jollylengkono.skripsi.Groups.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jollylengkono.skripsi.dao.GroupsDao;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

/**
 *
 * @author hp02
 */
public class GroupsDelete extends Action {
    private String FORWARD;
    private int STATE;

    public GroupsDelete() {
    }
    
    @Override
    public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response) {
        long id = Long.parseLong(request.getParameter("grp_id"));
        this.STATE = new GroupsDao().delete(id);
        if(this.STATE==1) {
            this.FORWARD="success";
        } else {
            this.FORWARD="fail";
        }
        return mapping.findForward(FORWARD);
    }
}
